package tmi.li.txwthrsmall;

import android.content.Context;
import android.content.SharedPreferences;


public class TxPref {

	public static String PREFS_NAME = "TxWthrPrefSmall";
	public static String FLCOLOR = "TxWthrSmallLeftColor";
	public static String FTCOLOR = "TxWthrSmallTopColor";
	public static String FBCOLOR = "TxWthrSmallBottomColor";
	public static String BCOLOR = "TxWthrSmallBackgroundColor";
	public static String LANG = "TxWthrSmallLanguage";
	public static String CURRENT = "TxWthrSmallCurrent";
	public static String DESC = "TxWthrSmallDesc";
	public static String DESC2 = "TxWthrSmallDesc2";
	public static String APPNAME = "TxWthrSmallAppName";
	public static String WOEID = "TxWthrSmallWoeid";
	public static String FORMAT = "TxWthrSmallFormat";
	
	
	public void saveMisc(Context context, int id, String what, String value) {
		SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
		prefs.putString(PREFS_NAME+id+what, value);
		prefs.commit();
	}
	
	public String getMisc(Context context, int id, String what) {
		SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        String prefix = prefs.getString(PREFS_NAME+id+what, null);    
        if(prefix != null) {
        	return prefix;     	
        }else {
        	return null;
        }
	}

	
	public void deleteMisc(Context context, int id) {
		SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
		prefs.remove(PREFS_NAME+id+TxPref.FLCOLOR);
		prefs.remove(PREFS_NAME+id+TxPref.FTCOLOR);
		prefs.remove(PREFS_NAME+id+TxPref.FBCOLOR);
		prefs.remove(PREFS_NAME+id+TxPref.BCOLOR);
		prefs.remove(PREFS_NAME+id+TxPref.CURRENT);
		prefs.remove(PREFS_NAME+id+TxPref.DESC);
		prefs.remove(PREFS_NAME+id+TxPref.DESC2);
		prefs.remove(PREFS_NAME+id+TxPref.LANG);
		prefs.remove(PREFS_NAME+id+TxPref.WOEID);
		prefs.remove(PREFS_NAME+id+TxPref.FORMAT);
		prefs.commit();
	}
	
	
	
	
	
}
